﻿<?php
require_once 'config.php';
require_once 'function.php';
switch(trim($_GET['act'])){
case "getbuyer":
$result=getfanlijiage();
echo number_format($result*$comm_rate,2);
break;
case "getBuy":
$url = "http://rate.taobao.com/member_rate.htm?userId=".$_GET['uid']."&identity=1&direction=0&rater=1";
$result = vita_get_url_content($url);
print trim(mb_convert_encoding($result,"utf-8","gb2312"));
break;
}
function getfanlijiage()
{global $appSecret,$usernick,$app_key,$comm_rate;
$outnum="";
$page=1;
do{
$result = GetTaoKeList($_GET['k'],"",floatval($_GET['p']),floatval($_GET['p']),"",$page,"",40);
$taobaokeItem = $result['taobaoke_items']['taobaoke_item'];
$PTOTAL = intval($result['total_results']);
if ($PTOTAL<=0)$outnum=0;
elseif($PTOTAL==1)$outnum=$taobaokeItem['commission'];
else{
foreach ($taobaokeItem as $mtwlist){
if($mtwlist['nick']==$_GET['n']){
$outnum= $mtwlist['commission'];
break;
}}}
$page=$page+1;
}while($outnum==""&&$PTOTAL>($page-1)*40);
if($outnum=="")
{
$result = GetShop($_GET['n']);
$sid = intval($result['shop']['sid']);
if($sid>0){
$result = ShopConvert($sid,"");
$outnum = $result['taobaoke_shops']['taobaoke_shop']['commission_rate']*$_GET['p']/100;
}
}
return floatval($outnum);
}
?> 